'use strict'
let Koa=require('koa');
let bodyparser=require('koa-bodyparser');
let controllers=require('./controllers');
let templating=require('./templating');
let staicts=require('koa-static');
let path=require('path');

let app=new Koa();

let root=path.resolve('.')
app.use(staicts(path.join(root,'static')));//静态文件处理
app.use(bodyparser());//body解析中间件
app.use(templating);//模板引擎
app.use(controllers());//路由

let port=4040;
app.listen(port);
console.log(`http://127.0.0.1:${port}`);